' Draw four circles at the center of the screen SCREEN 12 COLOR 4 CIRCLE (640 / 2, 480 / 2),25 ' COLOR 8 CIRCLE (640 / 2, 480 / 2),25 * 2 ' COLOR 9 CIRCLE (640 / 2, 480 / 2),25 * 3 ' COLOR 10 CIRCLE (640 / 2, 480 / 2),25 * 4 END
The previous program did arithmetic as part of a graphics statement. You can use variables with graphics statements as well. Here is a program to draw four circles at the center of the screen, but this time done with variables:
' Draw four circles at the center of the screen SCREEN 12 ' LET CENTERX = 640 / 2 LET CENTERY = 480 / 2 LET RADIUS = 25 ' COLOR 4 CIRCLE (CENTERX, CENTERY), RADIUS ' COLOR 8 CIRCLE (CENTERX, CENTERY), RADIUS * 2 ' COLOR 9 CIRCLE (CENTERX, CENTERY), RADIUS * 3 ' COLOR 10 CIRCLE (CENTERX, CENTERY), RADIUS * 4 END
This new program does same thing as the previous version. But by using variables it is more clear what it does, and the program is more easily modified.
How would you modify the above program so that the first circle has a radius of 10, and the other circles have radii of 20, 30, 40?